import {INCREMENT,DECREMENT} from "../constant/count"
const init = {
    count  : 0
}

export default function countReducer(preState = init , store) {
    const {type,data} = store;
    switch(type){
        case INCREMENT :
            return {
                ...init, count :  preState.count + data
            }
        case DECREMENT:
            return {
                ...init, count :  preState.count - data
            }

        default : return preState
    }
} 